//
//  Test_inheritance.hpp
//  learnC++
//
//  Created by liuzhibing on 2018/6/13.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#ifndef Test_inheritance_hpp
#define Test_inheritance_hpp

#include <stdio.h>
#include <iostream>
//菱形继承
//调用相同方法时，无法编译，应尽量避免
class Base5 {
    
private:
    int m_value;
    
public:
    
    Base5(int value = 0):m_value(value){
        
    }
    
    int getValue(){return m_value;}
    
};

class Child1 : Base5 {
private:
    int m_child1;
    
public:
    Child1(int child):m_child1(child){
        
    }
    
    int getValue(){return m_child1;}
};

class Child2 : Base5 {
private:
    int m_child2;
    
public:
    Child2(int child):m_child2(child){
        
    }
    
    int getValue(){return m_child2;}
};


class heterotype : public Child1,public Child2 {
    
private:
    int m_type;
    
public:
    heterotype(int child1,int child2,int type):Child1(child1),Child2(child2),m_type(type){
        
    }
};

/*
 
 heterotype a = heterotype(1, 2, 3);
 int b = a.getValue();//编译器报错，多个a.getValue()无法选择
 std::cout << b;
 
 */


#endif /* Test_inheritance_hpp */
